'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    // 得力产品数据
    const deliProducts = [
      {
        sku: 'DL-001',
        name: '得力(deli)中性笔',
        specification: '0.5mm 黑色 12支装',
        unit: '盒',
        category_id: 1, // 办公文具
        brand: '得力',
        description: '得力中性笔，书写顺滑，速干不晕染，适合日常办公使用',
        stock: 150,
        min_stock: 20,
        sale_price: 12.80,
        cost_price: 8.50,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'DL-002',
        name: '得力(deli)订书机',
        specification: '标准型 24/6 150页',
        unit: '个',
        category_id: 1, // 办公文具
        brand: '得力',
        description: '得力订书机，耐用金属材质，可订150页，适合办公室使用',
        stock: 80,
        min_stock: 10,
        sale_price: 25.00,
        cost_price: 16.00,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'DL-003',
        name: '得力(deli)文件夹',
        specification: 'A4 10个装 彩色',
        unit: '包',
        category_id: 2, // 办公用品
        brand: '得力',
        description: '得力文件夹，A4尺寸，10个装，多种颜色可选，方便分类管理',
        stock: 200,
        min_stock: 30,
        sale_price: 18.50,
        cost_price: 12.00,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'DL-004',
        name: '得力(deli)便利贴',
        specification: '76mm×76mm 4本装',
        unit: '套',
        category_id: 1, // 办公文具
        brand: '得力',
        description: '得力便利贴，可反复粘贴，不留痕迹，多种颜色可选',
        stock: 300,
        min_stock: 50,
        sale_price: 9.90,
        cost_price: 6.50,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'DL-005',
        name: '得力(deli)计算器',
        specification: '12位 太阳能+电池',
        unit: '个',
        category_id: 3, // 办公设备
        brand: '得力',
        description: '得力计算器，12位大屏幕显示，太阳能+电池双供电，功能齐全',
        stock: 60,
        min_stock: 10,
        sale_price: 35.00,
        cost_price: 22.00,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      }
    ];

    // 晨光产品数据
    const mengProducts = [
      {
        sku: 'MG-001',
        name: '晨光(M&G)中性笔',
        specification: '0.5mm 蓝色 10支装',
        unit: '盒',
        category_id: 1, // 办公文具
        brand: '晨光',
        description: '晨光中性笔，书写流畅，墨水速干，适合学生和办公使用',
        stock: 200,
        min_stock: 30,
        sale_price: 15.00,
        cost_price: 9.80,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'MG-002',
        name: '晨光(M&G)笔记本',
        specification: 'A5 80页 软面抄',
        unit: '本',
        category_id: 2, // 办公用品
        brand: '晨光',
        description: '晨光笔记本，A5尺寸，80页优质纸张，软面抄设计，携带方便',
        stock: 150,
        min_stock: 25,
        sale_price: 8.50,
        cost_price: 5.20,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'MG-003',
        name: '晨光(M&G)订书钉',
        specification: '24/6 1000枚',
        unit: '盒',
        category_id: 1, // 办公文具
        brand: '晨光',
        description: '晨光订书钉，标准24/6规格，1000枚装，适用于各类订书机',
        stock: 500,
        min_stock: 100,
        sale_price: 6.80,
        cost_price: 4.20,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'MG-004',
        name: '晨光(M&G)固体胶',
        specification: '21g 透明',
        unit: '支',
        category_id: 1, // 办公文具
        brand: '晨光',
        description: '晨光固体胶，21g容量，透明胶体，粘性强，使用方便',
        stock: 250,
        min_stock: 40,
        sale_price: 5.50,
        cost_price: 3.20,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'MG-005',
        name: '晨光(M&G)档案袋',
        specification: 'A4 50个装 牛皮纸',
        unit: '包',
        category_id: 2, // 办公用品
        brand: '晨光',
        description: '晨光档案袋，A4尺寸，牛皮纸材质，50个装，结实耐用',
        stock: 120,
        min_stock: 20,
        sale_price: 22.00,
        cost_price: 14.50,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      }
    ];

    // 其他品牌产品数据
    const otherProducts = [
      {
        sku: 'ST-001',
        name: '施耐德(Schneider)圆珠笔',
        specification: '0.7mm 黑色 5支装',
        unit: '盒',
        category_id: 1, // 办公文具
        brand: '施耐德',
        description: '施耐德圆珠笔，德国品质，书写顺滑，适合商务办公',
        stock: 100,
        min_stock: 15,
        sale_price: 38.00,
        cost_price: 25.00,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: '3M-001',
        name: '3M便利贴',
        specification: '76mm×76mm 6本装',
        unit: '套',
        category_id: 1, // 办公文具
        brand: '3M',
        description: '3M便利贴，经典黄色，可反复粘贴，高品质纸张',
        stock: 180,
        min_stock: 30,
        sale_price: 28.00,
        cost_price: 18.00,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'HL-001',
        name: '汇利彩色铅笔',
        specification: '12色 木质',
        unit: '盒',
        category_id: 4, // 美术用品
        brand: '汇利',
        description: '汇利彩色铅笔，12色套装，木质笔杆，色彩鲜艳，易上色',
        stock: 90,
        min_stock: 15,
        sale_price: 16.80,
        cost_price: 10.50,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'KD-001',
        name: '康达(A4)打印纸',
        specification: '80g 500张',
        unit: '包',
        category_id: 5, // 办公耗材
        brand: '康达',
        description: '康达A4打印纸，80g优质木浆纸，500张装，适用于各类打印机',
        stock: 300,
        min_stock: 50,
        sale_price: 26.50,
        cost_price: 17.80,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        sku: 'JS-001',
        name: '金士顿U盘',
        specification: '32GB USB3.0',
        unit: '个',
        category_id: 6, // 数码产品
        brand: '金士顿',
        description: '金士顿U盘，32GB容量，USB3.0接口，读写速度快，携带方便',
        stock: 75,
        min_stock: 10,
        sale_price: 45.00,
        cost_price: 30.00,
        status: 'active',
        created_at: new Date(),
        updated_at: new Date()
      }
    ];

    // 合并所有产品数据
    const allProducts = [...deliProducts, ...mengProducts, ...otherProducts];

    // 插入数据
    await queryInterface.bulkInsert('products', allProducts, {});
  },

  down: async (queryInterface, Sequelize) => {
    // 删除所有产品数据
    await queryInterface.bulkDelete('products', null, {});
  }
};